<template>
  <!-- 行情 -->
  <div v-if="compelet" class="app-container">
    <config-able-table
      v-for="k in Object.keys(meta)"
      :key="k"
      :table-headers="meta[k].tableHeaders"
      :uid="meta[k].uid"
      :table-name="meta[k].tableName"
      :name="meta[k].name"
      :style="meta[k].style"
      :event-name="meta[k].eventName"
    />
  </div>
</template>

<style scoped>
.quote-table {
  width: 100%;
  height: 150px;
}
</style>

<script>
import { getPageMetaList } from '@/api/normal'
export default {
  props: {
    pageName: {
      type: String,
      default: 'overview'
    }
  },
  data() {
    return {
      compelet: false,
      meta: {
      },
      listData: [],
      objectData: {}
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      getPageMetaList(this.pageName).then((response) => {
        if (response.code === 20000) {
          response.data.forEach((element) => {
            this.meta[element.name] = {}
            this.meta[element.name].tableName = element.title
            this.meta[element.name].tableHeaders = element.headers
            this.meta[element.name].uid = element.uid
            this.meta[element.name].tableName = element.name
            this.meta[element.name].style = element.style
            this.meta[element.name].eventName = element.event
          })
        }
        this.compelet = true
      })
    }
  }
}
</script>
